package edu.spec.xhd.week05.class1.work1.extend;

public class Main1 {
    public static void main(String[] args)
    {
        Animal a = new Animal("猩猩","man",6,"香蕉");
        a.born();
        a.eat();
        a.breed();
        Dog d = new Dog("旺财","women",4,"狗粮","哈士奇","嗷嗷嗷嗷嗷嗷~~");
        d.born();
        d.eat();
        d.breed();
        d.bark();
        d.milk();
        d.find();


    }
}
class Animal {
    public String name;
    public String gender;
    public int age;
    public String food;
    public Animal(){

    }
    public Animal(String name,String gender,int age,String food){
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.food = food;
    }
    public void born(){
        System.out.println("I was born with "+this.name);
    }
    public void eat(){
        System.out.println("I am "+this.name+",i eat "+this.food);
    }
    public void breed(){
        System.out.println("i breed");
    }

}
class Mammal extends Animal{

    public Mammal(){

    }
    public Mammal(String name,String gender,int age,String food){
        super.name = name;
        super.gender = gender;
        super.age = age;
        super.food = food;
    }
    public void milk(){

    }



}
class Dog extends Mammal {
    private String kind;
    private String barkSound;
    public Dog(){

    }
    public Dog(String name,String gender,int age,String food,String kind,String barkSound){
        super.name = name;
        super.gender = gender;
        super.age = age;
        super.food = food;
        this.kind = kind;
        this.barkSound = barkSound;
    }
    public void find(){
        System.out.println("I can help the owner get the ball back");
    }
    public void bark(){
        System.out.println("I kind is "+this.kind+",i barkSound is "+this.barkSound);
    }
}
